package com.qwt.server.utils;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @author 时光
 * @date 2021/12/10 10:4759
 */
public class ExceptionsUtil {
    /**
     * 异常栈信息转字符串
     * @param throwable 异常实例
     * @return 栈信息字符串
     */
    public static String getStackTraceAsString(Throwable throwable) {
        StringWriter stringWriter = new StringWriter();
        throwable.printStackTrace(new PrintWriter(stringWriter));
        return stringWriter.toString();
    }
}
